package cn.huijielong.modules.app.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.huijielong.common.utils.Query;
import cn.huijielong.common.utils.RD;
import cn.huijielong.modules.cm.service.DictionaryService;

@RestController
@RequestMapping("/app/param")
public class ParamsController {
	@Autowired
	private DictionaryService dictionaryService;
	
	@RequestMapping("contract")
    public RD login(){
		RD rd=RD.ok();
		List<Query> dicts=dictionaryService.queryDictsInTypes("depositTypeList","payTypeList","leaseTypeList","roomTypeList");
		Query datas=Query.empty();
		for(Query d:dicts) {
			String type=d.getString("type");
			List<Query> dictList=(List<Query>)datas.get(type);
			if(dictList==null) {
				dictList=new ArrayList<>();
				datas.put(type, dictList);
			}
			dictList.add(d);
		}
		rd.setData("paramList",datas);
		return rd;
	}
}
